﻿// This software is the confidential and proprietary information of NetBay.
// Such confidential information should not be disclosed.
// NetBay copyright(c) 2011

using System.ComponentModel;
using GalaSoft.MvvmLight.Command;
using Rio.Framework.Localisation;
using Rio.Framework.Pages.Controls;

namespace Rio.Framework.Pages.ChildWindows
{
    public partial class FolderHistoricChildWindow : INotifyPropertyChanged
    {
        #region Events

        public event PropertyChangedEventHandler PropertyChanged;

        #endregion

        #region Fields

        private FolderPage _folderPageContext;

        #endregion

        #region Properties

        public RelayCommand CloseCommand { get; set; }

        public FolderPage FolderPageContext
        {
            get { return _folderPageContext; }
            set
            {
                _folderPageContext = value;
                OnPropertyChanged("FolderPageContext");

                if (FolderPageContext.WorkflowManager != null)
                {
                    workflowDashboardHistoric.WorkflowManager = FolderPageContext.WorkflowManager;
                    workflowTab.IsEnabled = true;
                }
            }
        }

        #endregion

        #region Constructors

        public FolderHistoricChildWindow()
        {
            InitializeComponent();

            CloseCommand = new RelayCommand(Close);

            InitLabels();
        }

        #endregion

        public void OnPropertyChanged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        private void InitLabels()
        {
            this.Header = Resx.GetLabel(ResxWorkflow.Folder_Historic);
            workflowTab.Header = Resx.GetLabel(ResxCommon.WORKFLOW);
            closeButton.Content = Resx.GetLabel(ResxAlert.CLOSE);
        }
    }
}